/*     */ package com.feeyin.radar.sys.controller;
/*     */ 
/*     */ import com.feeyin.radar.commons.BigDecimalPropertyEditor;
/*     */ import com.feeyin.radar.commons.StringUtils;
/*     */ import com.feeyin.radar.sys.form.BusinessTargetForm;
/*     */ import com.feeyin.radar.sys.form.MonthTargetForm;
/*     */ import com.feeyin.radar.sys.service.BusinessTargetService;
/*     */ import com.feeyin.radar.sys.service.DepartmentService;
/*     */ import java.math.BigDecimal;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.springframework.web.bind.ServletRequestDataBinder;
/*     */ import org.springframework.web.servlet.ModelAndView;
/*     */ import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
/*     */ import org.springframework.web.servlet.view.RedirectView;
/*     */ 
/*     */ public class BusinessTargetController extends MultiActionController
/*     */ {
/*     */   private BusinessTargetService businessTargetService;
/*     */   private DepartmentService departmentService;
/*     */   private String businessTarget;
/*     */   private String emptyTarget;
/*     */   private String viewMonthTarget;
/*     */   private String viewSeasonTarget;
/*     */   private String viewYearTarget;
/*     */   private String updateTarget;
/*     */   private String updateMonthTarget;
/*     */   private String updateSeasonTarget;
/*     */   private String updateYearTarget;
/*     */   private String selectDept;
/*     */ 
/*     */   public BusinessTargetService getBusinessTargetService()
/*     */   {
/*  44 */     return this.businessTargetService;
/*     */   }
/*     */ 
/*     */   public void setBusinessTargetService(BusinessTargetService businessTargetService) {
/*  48 */     this.businessTargetService = businessTargetService;
/*     */   }
/*     */ 
/*     */   public DepartmentService getDepartmentService() {
/*  52 */     return this.departmentService;
/*     */   }
/*     */ 
/*     */   public void setDepartmentService(DepartmentService departmentService) {
/*  56 */     this.departmentService = departmentService;
/*     */   }
/*     */ 
/*     */   public String getBusinessTarget() {
/*  60 */     return this.businessTarget;
/*     */   }
/*     */ 
/*     */   public void setBusinessTarget(String businessTarget) {
/*  64 */     this.businessTarget = businessTarget;
/*     */   }
/*     */ 
/*     */   public String getEmptyTarget() {
/*  68 */     return this.emptyTarget;
/*     */   }
/*     */ 
/*     */   public void setEmptyTarget(String emptyTarget) {
/*  72 */     this.emptyTarget = emptyTarget;
/*     */   }
/*     */ 
/*     */   public String getViewMonthTarget() {
/*  76 */     return this.viewMonthTarget;
/*     */   }
/*     */ 
/*     */   public void setViewMonthTarget(String viewMonthTarget) {
/*  80 */     this.viewMonthTarget = viewMonthTarget;
/*     */   }
/*     */ 
/*     */   public String getViewSeasonTarget() {
/*  84 */     return this.viewSeasonTarget;
/*     */   }
/*     */ 
/*     */   public void setViewSeasonTarget(String viewSeasonTarget) {
/*  88 */     this.viewSeasonTarget = viewSeasonTarget;
/*     */   }
/*     */ 
/*     */   public String getViewYearTarget() {
/*  92 */     return this.viewYearTarget;
/*     */   }
/*     */ 
/*     */   public void setViewYearTarget(String viewYearTarget) {
/*  96 */     this.viewYearTarget = viewYearTarget;
/*     */   }
/*     */ 
/*     */   public String getUpdateTarget() {
/* 100 */     return this.updateTarget;
/*     */   }
/*     */ 
/*     */   public void setUpdateTarget(String updateTarget) {
/* 104 */     this.updateTarget = updateTarget;
/*     */   }
/*     */ 
/*     */   public String getUpdateMonthTarget() {
/* 108 */     return this.updateMonthTarget;
/*     */   }
/*     */ 
/*     */   public void setUpdateMonthTarget(String updateMonthTarget) {
/* 112 */     this.updateMonthTarget = updateMonthTarget;
/*     */   }
/*     */ 
/*     */   public String getUpdateSeasonTarget() {
/* 116 */     return this.updateSeasonTarget;
/*     */   }
/*     */ 
/*     */   public void setUpdateSeasonTarget(String updateSeasonTarget) {
/* 120 */     this.updateSeasonTarget = updateSeasonTarget;
/*     */   }
/*     */ 
/*     */   public String getUpdateYearTarget() {
/* 124 */     return this.updateYearTarget;
/*     */   }
/*     */ 
/*     */   public void setUpdateYearTarget(String updateYearTarget) {
/* 128 */     this.updateYearTarget = updateYearTarget;
/*     */   }
/*     */ 
/*     */   public String getSelectDept() {
/* 132 */     return this.selectDept;
/*     */   }
/*     */ 
/*     */   public void setSelectDept(String selectDept) {
/* 136 */     this.selectDept = selectDept;
/*     */   }
/*     */ 
/*     */   public ModelAndView display(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 141 */     Map map = new HashMap();
/* 142 */     map.put("businessTarget", this.businessTargetService.getBusinessTargetSettings(null));
/*     */ 
/* 144 */     return new ModelAndView(getBusinessTarget(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView emptyPage(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 149 */     return new ModelAndView(getEmptyTarget());
/*     */   }
/*     */ 
/*     */   public ModelAndView viewMonthTarget(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 154 */     String deptIds = request.getParameter("deptIds");
/*     */ 
/* 156 */     Map map = new HashMap();
/* 157 */     map.put("monthTargets", this.businessTargetService.getCurMonthTargetSalePerson(deptIds));
/* 158 */     return new ModelAndView(getViewMonthTarget(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView viewSeasonTarget(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 163 */     String deptIds = request.getParameter("deptIds");
/*     */ 
/* 165 */     Map map = new HashMap();
/* 166 */     map.put("monthTargets", this.businessTargetService.getCurSeasonTargetSalePerson(deptIds));
/* 167 */     return new ModelAndView(getViewSeasonTarget(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView viewYearTarget(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 172 */     String deptIds = request.getParameter("deptIds");
/*     */ 
/* 174 */     Map map = new HashMap();
/* 175 */     map.put("monthTargets", this.businessTargetService.getCurYearTargetSalePerson(deptIds));
/* 176 */     return new ModelAndView(getViewYearTarget(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView preUpdateTarget(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 181 */     Map map = new HashMap();
/* 182 */     String deptIds = request.getParameter("deptIds");
/* 183 */     map.put("deptIds", deptIds);
/* 184 */     String assignPeriod = request.getParameter("assignPeriod");
/* 185 */     map.put("assignPeriod", assignPeriod);
/*     */ 
/* 187 */     map.put("result", request.getParameter("result"));
/*     */ 
/* 189 */     BusinessTargetForm businessTarget = new BusinessTargetForm();
/* 190 */     businessTarget = this.businessTargetService.getBusinessTargetSettings(deptIds);
/* 191 */     if (!StringUtils.isEmpty(assignPeriod)) {
/* 192 */       businessTarget.setAssignPeriod(assignPeriod);
/*     */     }
/* 194 */     map.put("businessTarget", businessTarget);
/* 195 */     return new ModelAndView(getUpdateTarget(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView preSelectDept(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 200 */     Map map = new HashMap();
/* 201 */     map.put("departments", this.departmentService.getDepartments());
/* 202 */     return new ModelAndView(getSelectDept(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView selectDept(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 207 */     String deptIds = request.getParameter("deptIds");
/* 208 */     String assignPeriod = request.getParameter("assignPeriod");
/*     */ 
/* 210 */     return new ModelAndView(new RedirectView("./businessTarget.do?action=preUpdateTarget&deptIds=" + deptIds + "&assignPeriod=" + assignPeriod));
/*     */   }
/*     */ 
/*     */   public ModelAndView preUpdateMonthTarget(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 215 */     String deptIds = request.getParameter("deptIds");
/*     */ 
/* 217 */     Map map = new HashMap();
/* 218 */     map.put("monthTargets", this.businessTargetService.getCurMonthTargetSalePerson(deptIds));
/* 219 */     return new ModelAndView(getUpdateMonthTarget(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView preUpdateSeasonTarget(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 224 */     String deptIds = request.getParameter("deptIds");
/*     */ 
/* 226 */     Map map = new HashMap();
/*     */ 
/* 228 */     map.put("monthTargets", this.businessTargetService.getCurSeasonTargetSalePerson(deptIds));
/* 229 */     return new ModelAndView(getUpdateSeasonTarget(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView preUpdateYearTarget(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 234 */     String deptIds = request.getParameter("deptIds");
/*     */ 
/* 236 */     Map map = new HashMap();
/*     */ 
/* 238 */     map.put("monthTargets", this.businessTargetService.getCurYearTargetSalePerson(deptIds));
/* 239 */     return new ModelAndView(getUpdateYearTarget(), map);
/*     */   }
/*     */ 
/*     */   public ModelAndView updateTarget(HttpServletRequest request, HttpServletResponse response, MonthTargetForm monthTargetForm)
/*     */   {
/* 244 */     String deptIds = request.getParameter("deptIds");
/* 245 */     String assignPeriod = request.getParameter("assignPeriod");
/*     */ 
/* 247 */     boolean result = false;
/* 248 */     int success = 0;
/* 249 */     if ((!StringUtils.isEmpty(deptIds)) && 
/* 250 */       (!StringUtils.isEmpty(assignPeriod)) && 
/* 251 */       (monthTargetForm != null)) {
/* 252 */       result = this.businessTargetService.updateBusinessTarget(deptIds, assignPeriod, monthTargetForm);
/* 253 */       if (result) success = 1;
/*     */     }
/*     */ 
/* 256 */     return new ModelAndView(new RedirectView("./businessTarget.do?action=preUpdateTarget&result=" + success));
/*     */   }
/*     */ 
/*     */   protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception
/*     */   {
/* 261 */     binder.registerCustomEditor(BigDecimal.class, new BigDecimalPropertyEditor());
/*     */   }
/*     */ }

/* Location:           C:\Users\e547415\MyProject\rone\WEB-INF\classes\
 * Qualified Name:     com.feeyin.radar.sys.controller.BusinessTargetController
 * JD-Core Version:    0.6.0
 */